package yz.mr.partitioner;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

//注意当前Partitioner类是在   import org.apache.hadoop.mapreduce.Partitioner  下，并且分区实在这里操作
public class MyPartition extends Partitioner<Text,StudentText> {
    @Override
    public int getPartition(Text text, StudentText studentText, int i) {
        String age = studentText.age;
        if (age.equals("21")){
            return 0;
        }
        else if (age.equals("22")){
            return 1;
        }
        else if (age.equals("23")){
            return 2;
        }
        else {
            return 3;
        }
    }
}
